home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 326-350 / disk_348 / samp / testinstype.asm < prev    next >
Assembly Source File  |  1992-05-06  |  2KB  |  82 lines

  1. ;**************************************************************************
  2. ; Assembly example to test the dissidents instype.library.  This library
  3. ; makes it easy to manipulate the SAMP InstrumentType byte. SAMP is an IFF
  4. ; sampled sound format, and the InstrumentType byte tells what kind of
  5. ; sampled sound is being dealt with in musical terms (i.e. the sound of a
  6. ; snare drum).
  7. ;
  8. ; Only run this example from the CLI.
  9. ;
  10. ; blink startup.o test.o small.lib nodebug to TEST
  11.  
  12.     SMALLOBJ
  13.     ADDSYM
  14.     OBJFILE    "rad:Test.o"
  15.  
  16.     ;from StartUp.o
  17.     XREF    _SysBase,_DOSBase,_stdout
  18.  
  19.     ;from small.lib
  20.     XREF    _LVOWrite,_LVOOpenLibrary,_LVOCloseLibrary
  21.  
  22.     ;for instype.library
  23. _LVOGetInsType        equ    -30
  24. _LVOGetInsString    equ    -36
  25.  
  26.  
  27.     XDEF    _main
  28. _main:
  29.     ;--- Open the dissidents instype.library
  30.         movea.l    _SysBase,a6
  31.         moveq        #0,d0
  32.         lea        InsName,a1
  33.         jsr        _LVOOpenLibrary(a6)
  34.         move.l    d0,d1
  35.         bne.s        gotIt
  36.         ;--- ERROR: Can't open the instype.library
  37.         lea        CantOpen,a0
  38.         bsr.s        WriteStr
  39.         bra.s        outt
  40.     ;--- Let the user choose the desired InstrumentType
  41. gotIt    movea.l    d0,a6
  42.         suba.l    a1,a1            ;open on WB screen
  43.         jsr        _LVOGetInsType(a6)
  44.         move.l    d0,d1
  45.         bpl.s        gotTT
  46.         ;--- ERROR: I'm too lazy to explain
  47.         lea        ErrorLib,a0
  48.         bra.s        doprt
  49.     ;--- Now just get a string that represents the InstrumentType and print it
  50. gotTT    jsr        _LVOGetInsString(a6)
  51.         movea.l    d0,a0
  52. doprt    bsr.s        WriteStr
  53.     ;---Close the instype.library and exit
  54.         movea.l    a6,a1
  55.         movea.l    _SysBase,a6
  56.         jsr        _LVOCloseLibrary(a6)
  57. outt    moveq        #0,d0
  58.         rts
  59.  
  60. WriteStr:
  61.         movem.l    d2/d3/a6,-(sp)
  62.         suba.w    #200,sp
  63.         move.l    _stdout,d1
  64.         beq.s        WB
  65.         move.l    sp,a1
  66. enss    move.b    (a0)+,(a1)+
  67.         bne.s        enss
  68.         move.b    #10,-1(a1)
  69.         move.l    a1,d3
  70.         move.l    sp,d2
  71.         sub.l        d2,d3
  72.         movea.l    _DOSBase,a6
  73.         jsr        _LVOWrite(a6)
  74. WB        adda.w    #200,sp
  75.         movem.l    (sp)+,d2/d3/a6
  76.         rts
  77.  
  78. CantOpen    dc.b    'Can',$27,'t open the dissidents '
  79. InsName    dc.b    'instype.library',0
  80. ErrorLib    dc.b    'Error in obtaining InstrumentType',0
  81.  
  82.